# encoding  :  utf-8 _*_
# @author   :  朱清闯
# @software :  PyCharm
# time      :  2022/3/21 19:42
import random


def generate_random_code(type_code=1,length=4):
    if type_code == 1:
        all_chars = '0123456789abcdefghijklmnopqrstuvwsyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
    if type_code == 2:
        all_chars = '0123456789'
    code = random.sample(all_chars, length)
    code = "".join(code)
    return code
